﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LocalizedRequiredAttribute.shared.cs" company="Spenta Consulting">
//   (c) Copyright 2011
// </copyright>
// <summary>
//   Extends the RequiredAttribute to provide a custom message
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Spenta.StreetCare.Core.Shared.Attributes
{
    using System.ComponentModel.DataAnnotations;

    /// <summary>
    ///  Extends the RequiredAttribute to provide a custom message
    /// </summary>
    public partial class LocalizedRequiredAttribute : RequiredAttribute
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalizedRequiredAttribute"/> class.
        /// </summary>
        /// <param name="errorMessageResourceName">Name of the error message resource.</param>
        public LocalizedRequiredAttribute(string errorMessageResourceName)
        {
            this.ErrorMessageResourceName = string.IsNullOrEmpty(errorMessageResourceName) ? "Required_ValidationError" : errorMessageResourceName;
            ErrorMessageResourceType = typeof(Silverlight.Resources.Spenta_StreetCare_Core);
        }
    }
}
